import baseService from '../baseService/index.js'
import Taro from '@tarojs/taro'

// 获取历史app版本列表
const getAppVersionListApi = async (fileOwnership) => {
    return await baseService.post("/getHistoryAppPackageInfoList", {fileOwnership})
}

// 获取最新版的app信息
const getLatestAppInfoApi = async (fileOwnership) => {
    return await baseService.post("/getAppInfo", {fileOwnership})
}

// 下载app
const downloadAppApi = async (params) => {
    let res = await baseService.post("/downloadFile", params)
    if (!res.ok) {
        return res.data
    }
    return res
}

// 上传app
const uploadAppPackageApi = async (formData) => {
    console.log('上传的formData', formData, typeof formData);
    return await baseService.post("/uploadFile", formData, {type: 'formData'})
}

// 删除app信息
const deleteAppPackageApi = async (params) => {
    return await baseService.post("/deleteFile", params)
}

export {
    getLatestAppInfoApi,
    downloadAppApi,
    getAppVersionListApi,
    uploadAppPackageApi,
    deleteAppPackageApi
}